package com.aabte.design2.behavioral.iterator;

/**
 * 邮件发送者
 *
 * @author Daniel
 * @version 1.0
 * @date 2020/5/3
 */
public class SocialSpammer {

    public void send(ProfileIterator iterator, String message) {
        while (iterator.hasMore()) {
            Profile profile = iterator.getNext();
            sendEmail(profile, message);
        }
    }

    private void sendEmail(Profile profile, String message) {
        System.out.println("profile = " + profile + ", message = " + message);
    }

}
